﻿using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using NuGet.Packaging.Signing;
using System.Drawing.Printing;
using WMS_MAV;
using WMS_MAV.DTO.Carrier;
using WMS_MAV.DTO.Check;
using WMS_MAV.DTO.Receivable;
using WMS_MAV.DTO.Warehouse;
using WMS_MAV.DTO.Warehouse.Allocation;
using WMS_MAV.DTO.Warehouse.BinLocation;
using WMS_MAV.DTO.Warehouse.Move;
using WMS_MAV.DTO.Warehouse.Outbound;
using WMS_MAV.DTO.Warehouse.Storage;
using static WMS_MAV.Controllers.WarehouseController;

namespace WMS_MAV.Controllers
{
    public class WarehouseController : Controller
    {
        private readonly IConfiguration _configuration;
        public WarehouseController(IConfiguration configuration)
        {
            _configuration = configuration;
        }
        public IActionResult Index()
        {
            return View();
        }
        /// <summary>
        /// 调拨列表视图
        /// </summary>
        /// <returns></returns>
        public IActionResult AllocationShow()
        {
            return View();
        }
        /// <summary>
        /// 调拨新增视图
        /// </summary>
        /// <returns></returns>
        public IActionResult AllocationAdd()
        {
            return View();
        }
        /// <summary>
        /// 调拨修改视图
        /// </summary>
        /// <returns></returns>
        public IActionResult AllocationUpd()
        {
            return View();
        }
        /// <summary>
        /// 盘点列表视图
        /// </summary>
        /// <returns></returns>
        public IActionResult CheckShow()
        {
            return View();
        }
        /// <summary>
        /// 盘点新增视图
        /// </summary>
        /// <returns></returns>
        public IActionResult CheckAdd()
        {
            return View();
        }
        /// <summary>
        /// 盘点修改视图
        /// </summary>
        /// <returns></returns>
        public IActionResult CheckUpd()
        {
            return View();
        }
        /// <summary>
        /// 上传盘点结果视图
        /// </summary>
        /// <returns></returns>
        public IActionResult CheckupLoad()
        {
            return View();
        }
        /// <summary>
        /// 返回调拨管理数据
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> GetAllocationShow(string token, int pageIndex, int pageSize,string? allocationNo, string? createTime,string? allocationStatus)
        {
            
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouseRead/api/Allocation/GetAllocationList?PageIndex=" + pageIndex + "&PageSize=" + pageSize + "&AllocationNo=" + allocationNo + "&CreateTime=" + createTime + "&allocationStatus=" + allocationStatus;
            var response = await client.GetAsync(url);
            return Json(response);
        }
        /// <summary>
        /// 根据调拨id查询调拨产品
        /// </summary>
        /// <param name="model"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> GetAllocaitonShowbyid(AllocationShowByidDto dto)
        {

            HttpClientWrapper client = new HttpClientWrapper(dto.Token);
            string url = _configuration["Url"] + "warehouseRead/api/Allocation/GetAllocationByidList?AllocationId=" + dto.AllocationId;
            var response = await client.GetAsync(url);
            return Json(response);
        }
        /// <summary>
        /// 返回单据类型
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> GetAduiStatusShow(string token)
        {
            
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "/warehouseRead/api/Allocation/GetAuditStatus";
            var response = await client.GetAsync(url);
            return Json(response);
        }
        /// <summary>
        /// 删除调拨数据
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetAllocationDel(AllocationDeleteDto dto)
        {
            
            HttpClientWrapper client = new HttpClientWrapper(dto.Token);
            string url = _configuration["Url"] + "warehouse/api/Allocation/DeleteAllocation";
            var response = await client.PostAsync(url, dto.Data);
            return Json(response);
        }
        /// <summary>
        /// 批量删除调拨产品信息
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetAllocationDelRange(AllocationRangeDelDto dto)
        {

            HttpClientWrapper client = new HttpClientWrapper(dto.Token);
            string url = _configuration["Url"] + "warehouse/api/Allocation/DeleteRangeAllocation";
            var list = "{\"ids\":" + dto.Ids + "}";
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 批量反填产品数据
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetAllocationProductRangeModel(string productId,string token)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "/warehouseRead/api/Allocation/GetAllocationRangeProductModel";
            var list = "{\"productId\":" + productId + "}";
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 添加调拨管理
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetAllocationAdd(AllocationAddDto field,string token)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "/warehouse/api/Allocation/AddAllocation";
            string list = JsonConvert.SerializeObject(field);
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 调拨反填
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> GetFanAllocation(string token, int allocationId)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "/warehouseRead/api/Allocation/GetAllocationProductModelList?AllocationId=" + allocationId;
            var response = await client.GetAsync(url);
            return Json(response);
        }
        /// <summary>
        /// 修改调拨管理
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetUpdAllocation(string token, AllocationAddDto field)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "/warehouse/api/Allocation/UpdateAllocation";
            string list = JsonConvert.SerializeObject(field);
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 审批调拨管理
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetAllocationAudit(AllocationAuditDto obj1, string token)
        {

            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/Allocation/AuditAllocation";
            string list = JsonConvert.SerializeObject(obj1);
            var response = await client.PostAsync(url, list);
            return Json(response);
        }

        /// <summary>
        /// 返回盘点列表数据
        /// </summary>
        /// <param name="model"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> GetCheckShow(CheckShowDto dto)
        {

            HttpClientWrapper client = new HttpClientWrapper(dto.Token);
            string url = _configuration["Url"] + "warehouseRead/api/Check/GetAllocationList?PageIndex" + dto.PageIndex + "&PageSize=" + dto.PageSize + "&CheckNo=" + dto.CheckNo + "&CreateTime=" + dto.CreateTime + "&AuditStatus=" + dto.AuditStatus;
            var response = await client.GetAsync(url);
            return Json(response);
        }
        /// <summary>
        /// 返回入库产品列表数据
        /// </summary>
        /// <param name="model"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> GetProductStorageListShow(ProductStorageShowDto dto)
        {

            HttpClientWrapper client = new HttpClientWrapper(dto.Token);
            string url = _configuration["Url"] + "warehouseRead/api/Allocation/GetProductStorageProductList?ProductNo=" + dto.ProductNo + "&ProductName=" + dto.ProductName + "&PageIndex=" + dto.PageIndex + "&PageSize=" + dto.PageSize;
            var response = await client.GetAsync(url);
            return Json(response);
        }
        /// <summary>
        /// 添加盘点管理
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetCheckAdd(CheckAddDto field, string token)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/Check/AddCheck";
            string list = JsonConvert.SerializeObject(field);
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 盘点反填
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> GetFanCheck(string token, int checkId)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouseRead/api/Check/GetCheckModel?CheckId=" + checkId;
            var response = await client.GetAsync(url);
            return Json(response);
        }
        /// <summary>
        /// 修改盘点管理
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetUpdCheck(string token, CheckAddDto field)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/Check/GetUpdCheck";
            string list = JsonConvert.SerializeObject(field);
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 删除盘点数据
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetCheckDel(CheckDeleteDto dto)
        {

            HttpClientWrapper client = new HttpClientWrapper(dto.Token);
            string url = _configuration["Url"] + "warehouse/api/Check/GetDelCheck";
            var response = await client.PostAsync(url, dto.Data);
            return Json(response);
        }
        /// <summary>
        /// 批量删除盘点产品信息
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetCheckDelRange(CheckRangeDelDto dto)
        {

            HttpClientWrapper client = new HttpClientWrapper(dto.Token);
            string url = _configuration["Url"] + "warehouse/api/Check/GetDelRangeCheck";
            var list = "{\"ids\":" + dto.Ids + "}";
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 上传盘点结果
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetUpLoadCheck(string token, CheckUploadDto field)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/Check/GetUpdStatistics";
            string list = JsonConvert.SerializeObject(field);
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 仓库显示
        /// </summary>
        /// <returns></returns>
        public IActionResult WarehouseShow()
        {
            return View();
        }
        /// <summary>
        /// 仓库显示
        /// </summary>
        /// <param name="warehouse"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> GetWarehouseShow(WarehouseShowDTO warehouse)
        {
            HttpClientWrapper client = new HttpClientWrapper(warehouse.Token);
            string url = _configuration["Url"]+"warehouseRead/api/WarehouseMange/GetWarehouse?pageIndex=" + warehouse.pageIndex + "&pageSize=" + warehouse.pageSize + "&warehouseNo=" + warehouse.warehouseNo + "&warehouseName=" + warehouse.warehouseName + "&departmentId=" + warehouse.departmentId + "&warehouseTypeId=" + warehouse.warehouseTypeId;
            var response = await client.GetAsync(url);
            return Json(response);
        }
        /// <summary>
        /// 仓库类型显示
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> GetWarehouseTypeShow(string token)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouseRead/api/WarehouseMange/GetWarehouseTypes";
            var response = await client.GetAsync(url);
            return Json(response);
        }
        /// <summary>
        /// 删除仓库管理
        /// </summary>
        /// <param name="warehouseIds"></param> 
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetDelectWarehouse(string token,DelectWarehouseDTO warehouseIds)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/WarehouseInfos/DelectWarehouseInfo";
            var para = new { warehouseId = warehouseIds.warehouseId };
            string list = JsonConvert.SerializeObject(para);
            
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 批量删除仓库管理
        /// </summary>
        /// <param name="warehouseId"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetPlDelectWarehouse(string token, PlDelectWarehouseDTO warehouseId)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/WarehouseInfos/DelectRangeWarehouseInfo";
            //var para = new { warehouseId = warehouseId.warehouseId };
            string list = JsonConvert.SerializeObject(warehouseId);
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 添加仓库
        /// </summary>
        /// <returns></returns>
        public IActionResult AddWarehouse()
        {
            return View();
        }
        /// <summary>
        /// 添加仓库管理
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetAddWarehouse(string token, AddWarehouseDTO field)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/WarehouseInfos/AddWarehouseInfo";
            string list = JsonConvert.SerializeObject(field);
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 仓库修改
        /// </summary>
        /// <returns></returns>
        public IActionResult WarehouseUpd()
        {
            return View();
        }
        /// <summary>
        /// 仓库反填
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> GetFanWarehouse(string token,int warehouseId)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouseRead/api/WarehouseMange/FanWarehouseInfo?warehouseId=" + warehouseId;
            var response = await client.GetAsync(url);
            return Json(response);
        }
        /// <summary>
        /// 修改仓库管理
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetUpdWarehouse(string token, AddWarehouseDTO obj1)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/WarehouseInfos/UpdateWarehouseInfo";
            string list = JsonConvert.SerializeObject(obj1);
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 添加入库
        /// </summary>
        /// <returns></returns>
        public IActionResult AddStorage()
        {
            return View();
        }
        /// <summary>
        /// 添加入库管理
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetAddStorage(string token, AddStorageDTO field)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/Storage/AddStorage";
            string list = JsonConvert.SerializeObject(field);
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 入库显示
        /// </summary>
        /// <returns></returns>
        public IActionResult StorageShow()
        {
            return View();
        }
        /// <summary>
        /// 入库显示
        /// </summary>
        /// <param name="storage"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> GetStorageShow(StorageShowDTO storage)
        {
            HttpClientWrapper client = new HttpClientWrapper(storage.Token);
            string url = _configuration["Url"] + "warehouseRead/api/StorageMange/GetStorage?pageIndex=" + storage.pageIndex + "&pageSize=" + storage.pageSize + "&storageNo=" + storage.storageNo + "&storageType=" + storage.storageType + "&storageStatus=" + storage.storageStatus;
            var response = await client.GetAsync(url);
            return Json(response);
        }
        /// <summary>
        /// 删除入库数据
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetDelectStorage(DelectStorageDTO dto)
        {

            HttpClientWrapper client = new HttpClientWrapper(dto.Token);
            string url = _configuration["Url"] + "warehouse/api/Storage/DelectStorage";
            var response = await client.PostAsync(url, dto.Data);
            return Json(response);
        }
        /// <summary>
        /// 批量删除入库产品信息
        /// </summary>
        /// <param name="storageProductsId"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetPlDelectStorage(string token,DelectRangeStorageDTO storageProductsId)
        {

            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/Storage/DelectRangeStorage";
            string list = JsonConvert.SerializeObject(storageProductsId);
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 审批入库管理
        /// </summary>
        /// <param name="obj1"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetStorageAudit(StorageAuditDTO obj1, string token)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/Storage/AuditStorage";
            string list = JsonConvert.SerializeObject(obj1);
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 修改入库
        /// </summary>
        /// <returns></returns>
        public IActionResult StorageUpd()
        {
            return View();
        }
        /// <summary>
        /// 入库反填
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> GetFanStorage(string token, int storageId)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouseRead/api/StorageMange/FanStorage?storageId=" + storageId;
            var response = await client.GetAsync(url);
            return Json(response);
        }
        /// <summary>
        /// 修改入库管理
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetUpdStorage(string token, AddStorageDTO field)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/Storage/UpdateStorage";
            string list = JsonConvert.SerializeObject(field);
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 添加库位
        /// </summary>
        /// <returns></returns>
        public IActionResult AddBinLocation()
        {
            return View();
        }
        /// <summary>
        /// 添加库位管理
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetAddBinLocation(string token, AddBinLocationDTO field)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/BinLocation/AddBinLocation";
            string list = JsonConvert.SerializeObject(field);
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 库位显示
        /// </summary>
        /// <returns></returns>
        public IActionResult BinLocationShow()
        {
            return View();
        }
        
        /// <summary>
        /// 库位显示
        /// </summary>
        /// <param name="binLocation"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> GetBinLocationShow(BinLocationShowDTO binLocation)
        {
            HttpClientWrapper client = new HttpClientWrapper(binLocation.Token);
            string url = _configuration["Url"] + "warehouseRead/api/BinLocationMange/GetBinLocation?pageIndex=" + binLocation.pageIndex + "&pageSize=" + binLocation.pageSize + "&binLocationNo=" + binLocation.binLocationNo + "&binLocationName=" + binLocation.binLocationName + "&warehouseId=" + binLocation.warehouseId;
            var response = await client.GetAsync(url);
            return Json(response);
        }
        /// <summary>
        /// 库位名称下拉显示
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> GetBinLocationNameShow(string token)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouseRead/api/BinLocationMange/GetBinLocationName";
            var response = await client.GetAsync(url);
            return Json(response);
        }
        /// <summary>
        /// 仓库类型显示
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> GetWarehouseLShow(string token)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouseRead/api/BinLocationMange/GetWarehouseList";
            var response = await client.GetAsync(url);
            return Json(response);
        }
        /// <summary>
        /// 仓库类型显示
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> GetWarehouseLocations(string token)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouseRead/api/BinLocationMange/GetWarehouseLocation";
            var response = await client.GetAsync(url);
            return Json(response);
        }

        /// <summary>
        /// 删除库位管理
        /// </summary>
        /// <param name="binLocationIds"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetDelectBinLocation(string token, DelectBinLocationDTO binLocationIds)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/BinLocation/DelectBinLocation";
            string list = JsonConvert.SerializeObject(binLocationIds);
            var response = await client.PostAsync(url, list);
            return Json(response);
        }

        /// <summary>
        /// 批量删除库位管理
        /// </summary>
        /// <param name="binLocationIds"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetPlDelectBinLocation(string token, PlDelectBinLocationDTO binLocationIds)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/BinLocation/DelectRangeBinLocation";
            string list = JsonConvert.SerializeObject(binLocationIds);
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 库位修改
        /// </summary>
        /// <returns></returns>
        public IActionResult BinLocationUpd()
        {
            return View();
        }
        /// <summary>
        /// 修改库位管理
        /// </summary>
        /// <param name="obj1"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetBinLocationUpd(string token, AddBinLocationDTO obj1)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/BinLocation/UpdateBinLocation";
            string list = JsonConvert.SerializeObject(obj1);
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 库位反填
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> GetBinLocationFan(string token, int binLocationId)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouseRead/api/BinLocationMange/FanBinLocation?binLocationId=" + binLocationId;
            var response = await client.GetAsync(url);
            return Json(response);
        }
        /// <summary>
        /// 移库显示
        /// </summary>
        /// <returns></returns>
        public IActionResult MoveShow()
        {
            return View();
        }
        /// <summary>
        /// 移库添加
        /// </summary>
        /// <returns></returns>
        public IActionResult MoveAdd()
        {
            return View();
        }
        /// <summary>
        /// 移库修改
        /// </summary>
        /// <returns></returns>
        public IActionResult MoveUpd()
        {
            return View();
        }
        /// <summary>
        /// 移库添加
        /// </summary>
        /// <param name="storage"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetMoveAdd(string token, AddModeDTO field)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/Move/AddMove";
            string list = JsonConvert.SerializeObject(field);
            var response = await client.PostAsync(url,list);
            return Json(response);
        }
        /// <summary>
        /// 移库显示
        /// </summary>
        /// <param name="storage"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> GetMoveShow(string token, int pageIndex, int pageSize, string? moveTheLibraryNo, string? moveTheLibraryType,int auditStatus)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouseRead/api/Move/MoveShow?pageIndex=" + pageIndex + "&pageSize=" + pageSize + "&moveTheLibraryNo=" + moveTheLibraryNo + "&moveTheLibraryType=" + moveTheLibraryType + "&auditStatus=" + auditStatus;
            var response = await client.GetAsync(url);
            return Json(response);
        }
        /// <summary>
        /// 移库反填
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> GetFanMove(string token, int moveTheLibraryId)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouseRead/api/Move/FanStorage?moveTheLibraryId=" + moveTheLibraryId;
            var response = await client.GetAsync(url);
            return Json(response);
        }
        /// <summary>
        /// 移库修改
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetUpdMove(string token, AddModeDTO field)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = "http://10.223.8.18:8000/warehouse/api/Move/UpdateMove";
            string list = JsonConvert.SerializeObject(field);
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        /// <summary>
        /// 移库删除
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        /// 
        [HttpPost]
        public async Task<ActionResult> GetDeleteMove(MoveDeleteDTO dto)
        {
            HttpClientWrapper client = new HttpClientWrapper(dto.Token);
            string url = _configuration["Url"]+"/warehouse/api/Move/DelectMove";
            var response = await client.PostAsync(url, dto.Data);
            return Json(response);
        }
        /// <summary>
        /// 批量删除移库产品信息
        /// </summary>
        /// <param name="storageProductsId"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetPlDelectMove(string token, DelectRangeMoveDTO moveProductId)
        {

            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/Move/DelectRangeMove";
            string list = JsonConvert.SerializeObject(moveProductId);
            var response = await client.PostAsync(url, list);
            return Json(response);
        }
        public IActionResult OutboundAdd()
        {
            return View();
        }
        /// <summary>
        /// 添加出库管理
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        [HttpPost]                    
        public async Task<ActionResult> GetAddOutbound(string token, string model)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/Outbound/OutboundAdd";
            var response = await client.PostAsync(url, model);
            return Json(response);
        }
        [HttpGet]
        public async Task<ActionResult> ProductShow(string token)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = "http://10.223.8.18:8000/api/ProductSelect/GetProductInfos";
            var response = await client.GetAsync(url);
            return Json(response);
        }
        /// <summary>
        /// 出库显示视图
        /// </summary>
        /// <returns></returns>
        public IActionResult OutboundShow()
        {
            return View();
        }
        /// <summary>
        /// 出库显示
        /// </summary>
        /// <param name="model"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> OutBoundShowDo(string model, string token)
        {
            HttpClientWrapper httpClientWrapper = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouseRead/api/Outbound/OutboundAdd";
            var datas = JsonConvert.SerializeObject(model);
            var response = await httpClientWrapper.PostAsync(url, model);
            return Json(response);
        }
        /// <summary>
        /// 出库单删
        /// </summary>
        /// <param name="model"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> OutBoundIsdelDo(string model, string token)
        {
            HttpClientWrapper httpClientWrapper = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/Outbound/OutboundDelete";
            var datas = JsonConvert.SerializeObject(model);
            var response = await httpClientWrapper.PostAsync(url, model);
            return Json(response);
        }
        /// <summary>
        /// 出库批删
        /// </summary>
        /// <param name="model"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> OutBoundIsdelAllDo(string model, string token)
        {
            HttpClientWrapper httpClientWrapper = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/Outbound/OutboundIsdelAll";
            var datas = JsonConvert.SerializeObject(model);
            var response = await httpClientWrapper.PostAsync(url, model);
            return Json(response);
        }
        /// <summary>
        /// 反填出库管理
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetFanAllOutbound(string token, string model)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouseRead/api/Outbound/OutProductShow";
            string list = JsonConvert.SerializeObject(model);
            var response = await client.PostAsync(url, model);
            return Json(response);
        }
        /// <summary>
        /// 出库修改视图
        /// </summary>
        /// <returns></returns>
        public IActionResult OutboundUpdate()
        {
            return View();
        }
        /// <summary>
        /// 反填出库
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> GetFanUpdate(string token, string model)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/Outbound/OutboundFan";
            string list = JsonConvert.SerializeObject(model);
            var response = await client.PostAsync(url, model);
            return Json(response);
        }
        /// <summary>
        /// 修改出库
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ActionResult> UpdateOutbound(string token, string model)
        {
            HttpClientWrapper client = new HttpClientWrapper(token);
            string url = _configuration["Url"] + "warehouse/api/Outbound/OutboundUpdate";
            var response = await client.PostAsync(url, model);
            return Json(response);
        }
    }
}
